*** Summary statistics
use "experimental_data.dta", clear


* section 3.1
bys task_type: sum correct
sum intuitive_response if task_type=="crt"
bys spec_task_no: pwcorr anchor response if task_type=="anchoring", sig

* section 3.2
bys task_type: sum response_time
bys condition: sum response_time
bys task_type condition: sum response_time

* Table 1: Regressions response times

fvset base 1 spec_task_no 		

eststo clear
foreach i in crt brn_abstract brn_intuitive wason_abstract wason_intuitive anchoring{
	eststo: qui reg response_time no_stakes high_stakes if task_type=="`i'", cl(id)
	test no_stakes=high_stakes
	}
	eststo: qui reg response_time no_stakes high_stakes i.task_type_no, cl(id)
	test no_stakes=high_stakes

esttab 	using "Tables/response_time.tex", ///
		booktabs nonotes replace compress  label nomtitles ///
		indicate("Task type FE=*task_type_no") ///
		se(2) b(a2) r2(2)  star(* 0.05 ** 0.01) ///
		prehead("{\begin{tabular}{l*{7}{c}}\toprule\toprule&\multicolumn{7}{c}{\textit{Dependent variable:}}\\[.1cm] &\multicolumn{7}{c}{Response time [seconds]} \\\cmidrule(lr){2-8}\\ Omitted category:  & & \multicolumn{2}{c}{Base rate neglect} & \multicolumn{2}{c}{Contingent reasoning} && All \\\cmidrule(lr){3-4}\cmidrule(lr){5-6}  \textit{Standard incentives} & CRT & Abstract & Intuitive &Abstract & Intuitive & Anchoring & tasks\\\cmidrule(lr){2-2}\cmidrule(lr){3-3}\cmidrule(lr){4-4}\cmidrule(lr){5-5}\cmidrule(lr){6-6}\cmidrule(lr){7-7}\cmidrule(lr){8-8} ")
	
* section 3.3
* Table 2: Regressions performance

fvset base 1 spec_task_no 		

eststo clear
foreach i in crt brn_abstract brn_intuitive wason_abstract wason_intuitive{
	eststo: qui reg correct no_stakes high_stakes if task_type=="`i'", cl(id)
	test no_stakes=high_stakes
	}
	eststo: qui reg correct no_stakes high_stakes i.task_type_no if task_type!="anchoring", cl(id)
	test no_stakes=high_stakes
	eststo: qui reg response no_stakes high_stakes anchor inter_anchor_no inter_anchor_high if task_type=="anchoring", cl(id)
	test inter_anchor_no=inter_anchor_high
	
esttab 	using "Tables/performance.tex", ///
		booktabs nonotes replace compress  label nomtitles ///
		indicate("Task type FE=*task_type_no") ///
		se(2) b(a2) r2(2)  star(* 0.05 ** 0.01) ///
		prehead("{\begin{tabular}{l*{7}{c}}\toprule\toprule&\multicolumn{7}{c}{\textit{Dependent variable:}}\\[.1cm] &\multicolumn{6}{c}{1 if answer correct} & Answer \\\cmidrule(lr){2-7}\cmidrule(lr){8-8}\\ Omitted category: & & \multicolumn{2}{c}{Base rate neglect} & \multicolumn{2}{c}{Contingent reasoning} & Tasks & \\\cmidrule(lr){3-4}\cmidrule(lr){5-6} \textit{Standard incentives} & CRT & Abstract & Intuitive &Abstract & Intuitive & 1--5 &Anchoring\\\cmidrule(lr){2-2}\cmidrule(lr){3-3}\cmidrule(lr){4-4}\cmidrule(lr){5-5}\cmidrule(lr){6-6}\cmidrule(lr){7-7}\cmidrule(lr){8-8} ")
	
	
* section 3.4
preserve
collapse correct expert_pred_perform, by(condition task_type)
replace correct=0.46 if task_type=="anchoring" & condition=="no"
reshape wide correct expert_pred_performance, i(task) j(condition) string
gen exp_no_low= expert_pred_performancelow/correctno
gen exp_low_high= expert_pred_performancehigh/expert_pred_performancelow
sum exp_no_low exp_low_high
restore

* section 3.5
bys task: sum confidence
		
